import {
    DIC
} from '@/const/dic'
export const option = {
    index:true,
    indexLabel:'序号',
    border: true,
    selection: false,
    menuBtn: false,
    addBtn:false,
    cellBtn: false,
    editBtn: false,
    size: 'mini',
    columnBtn:false,
    refreshBtn:false,
    delBtn: false,
    dicData: DIC,
    align: "center",
    menuWidth: 210,
    menuAlign: "center",
    column: [{
        label: "审批单号",
        prop: "approvalNumber",
        slot: true,
    },{
        label: "报废类型",
        prop: "scrapType",
        slot: true,
    },{
        label: "设备类别",
        prop: "equipmentTypeName",
        slot: true,
    },{
        label: "设备编码",
        prop: "coded",
        slot: true,
    },{
        label: "设备名称",
        prop: "equipmentName",
        slot: true,
    },{
        label: "型号",
        prop: "marking",
        slot: true,
    },{
        label: "品牌",
        prop: "brand",
        slot: true,
    },{
        label: "存放位置",
        prop: "locationName",
    }]
};
export function jsonToArray(nodes) {
    var r=[];
    if (Array.isArray(nodes)) {
      for (var i=0, l=nodes.length; i<l; i++) {
        r.push(nodes[i]); // 取每项数据放入一个新数组
        if (Array.isArray(nodes[i]["children"])&&nodes[i]["children"].length>0)
         // 若存在children则递归调用，把数据拼接到新数组中，并且删除该children
          r = r.concat(jsonToArray(nodes[i]["children"]));
            delete nodes[i]["children"]
      }
    } 
    return r;
}


export const scrapOption = {
    index:true,
    indexLabel:'序号',
    border: true,
    selection: false,
    menuBtn: false,
    size: 'mini',
    addBtn:false,
    cellBtn: false,
    editBtn: false,
    columnBtn:false,
    refreshBtn:false,
    delBtn: false,
    dicData: DIC,
    align: "center",
    menuWidth: 240,
    menuAlign: "center",
    column: [{
        label: "审批单号",
        prop: "approvalNumber",
        slot: true,
    },{
        label: "报废类型",
        prop: "scrapType",
        slot: true,
    },{
        label: "设备类别",
        prop: "equipmentTypeName",
        slot: true,
    },{
        label: "设备编码",
        prop: "coded",
        slot: true,
    },{
        label: "型号",
        prop: "marking",
        slot: true,
    },{
        label: "品牌",
        prop: "brand",
        slot: true,
    },{
        label: "放置位置",
        prop: "locationName",
    },{
        label: "处理人",
        prop: "processor",
    },{
        label: "处理时间",
        prop: "processDate",
        width: 120,
    },{
        label: "出售价格(元)",
        prop: "price",
    },{
        label: "最后修改人",
        prop: "updateName",
    },{
        label: "时间",
        prop: "updateTime",
        width: 120,
    }]
};